package com.example.jedis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.Transaction;

import java.io.IOException;
import java.util.List;
import java.util.Random;

/**
 * 描述该类
 *
 * @author <a href="920786312@qq.com">周飞</a>
 * @class: RedisTestController
 * @date 2022/2/3 14:11
 * @Verson 1.0 -2022/2/3 14:11
 * @see
 */
@RestController
public class SecondKillController {
    
    /**
     * @param prodId 商品id
     * @author <a href="920786312@qq.com">周飞</a>
     * @since 2022/2/3 14:51
     */
    @RequestMapping("/second_kill")
    public boolean secondKill(@RequestParam("prodId") String prodId) throws IOException {
        
        String userId = new Random().nextInt(50000) + "";
        return DoSecKill_v3.doSecKill(userId, prodId);
    }
    
}